/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						       obelisk_marker.h

	$Header:  $

	$NoKeywords: $

 ************************************************************************/

#if !defined( OBELISK_MARKER_H_INCLUDED )
#define OBELISK_MARKER_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "stationary_adventure_object.h"

enum t_obelisk_color;

// -------------------------------------------------------------------
// t_obelisk_marker class
// The marker data, as actually stored in the map
// -------------------------------------------------------------------
class t_obelisk_marker 
{
public:
	t_obelisk_marker( );
	t_obelisk_marker( t_level_map_point_2d const & location, t_uint16 radius );

	t_level_map_point_2d get_location() const;
	t_uint16             get_radius() const;
	bool				 read( std::streambuf & stream );
	bool				 write( std::streambuf & stream ) const;

private:
	// Data
	// The artifact can be within m_radius squares of m_location
	t_level_map_point_2d m_location;
	t_uint16             m_radius;
};

// -------------------------------------------------------------------
// t_obelisk_marker inline functions
// -------------------------------------------------------------------

// -------------------------------------------------------------------
// -------------------------------------------------------------------
inline t_obelisk_marker::t_obelisk_marker( )
	:  m_radius( 0 )
{
}

// -------------------------------------------------------------------
// -------------------------------------------------------------------
inline t_obelisk_marker::t_obelisk_marker( t_level_map_point_2d const & location, t_uint16 radius )
	: m_location( location ), m_radius( radius )
{
}

// -------------------------------------------------------------------
// Location of marker
// -------------------------------------------------------------------
inline t_level_map_point_2d t_obelisk_marker::get_location() const
{
	return m_location;
}

// -------------------------------------------------------------------
// Radius around location where artifact can be placed
// -------------------------------------------------------------------
inline t_uint16 t_obelisk_marker::get_radius() const
{
	return m_radius;
}



// -------------------------------------------------------------------
// t_adv_obelisk_marker class
// A marker for where an obelisk's relic or treasure is going to
// be placed, as seen by the map while doing a new map read. Note that
// t_adv_obelisk_marker objects are never actually added to the map;
// they just read in their information and then update the map's obelisk 
// data
// -------------------------------------------------------------------
class t_adv_obelisk_marker : public t_stationary_adventure_object
{
public:
	t_adv_obelisk_marker( std::string const& source );

	t_obelisk_color get_color() const;
	t_uint16        get_radius() const;
	virtual bool    read_from_map( std::streambuf& buffer, t_progress_handler* );
	virtual void	place( t_adventure_map& map, t_adv_map_point const& point );

private:
	t_uint16		m_radius;
};

// -------------------------------------------------------------------
// t_adv_obelisk_marker inline functions
// -------------------------------------------------------------------

// -------------------------------------------------------------------
// -------------------------------------------------------------------
inline t_adv_obelisk_marker::t_adv_obelisk_marker( std::string const& source )
	: t_stationary_adventure_object( source ),
	  m_radius( 0 )
{
}

// -------------------------------------------------------------------
// The obelisk color this is a marker for
// -------------------------------------------------------------------
inline t_obelisk_color t_adv_obelisk_marker::get_color() const
{
	return t_obelisk_color(get_major_subtype());
}

// -------------------------------------------------------------------
// The radius around the obelisk marker where the treasure could
// be placed
// -------------------------------------------------------------------
inline t_uint16 t_adv_obelisk_marker::get_radius() const
{
	return m_radius;
}

#endif // !defined( OBELISK_MARKER_H_INCLUDED )
